<template>
  <div class="pagination">
    <el-pagination
      background
      layout="prev, pager, next"
      @current-change="handleCurrentChange"
      @prev-click="handlePrevClick"
      @next-click="handleNextClick"
      :page-size='pageSize'
      :total="total"
      :hide-on-single-page= true>
    </el-pagination>
  </div>
</template>

<script>
export default {
  name: 'SandTachievementsGrouppage',
  // props: [
  //   'ftotal',
  // ],
  data () {
    return {
      pageSize: 10, // 页面容量
      currentPage: 1, // 当前页
      total:0,
    }
  },
  watch:{
    total:{
    handler(newVal,oldVal){
      this.total=newVal;
      // console.log("监视的总数：",this.total)
    }
    }
  },
  methods: {
    sendtotal(nowtotal){
      console.log("新的total:",nowtotal)
      this.total=nowtotal;
    },
    initData(){
				console.log(this.ftotal);
		},
    // 点击
    handleCurrentChange(val){
      this.currentPage = val;
      this.getpage(val);
    },
    // 上一页
    handlePrevClick(val){
      this.getpage(val);
    },
    // 下一页
    handleNextClick(val){
      this.getpage(val);
    },
   
    //获取当前页
    getpage(val){
      // console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@",val,this.pageSize)
      this.$emit('getcurrentPage',val);
      this.$emit('getpageSize',this.pageSize);
    }
  },
}
</script>

<style scoped>
.pagination{
  margin: 40px;
}
</style>